package composite;

public class Main {
    public static void main(String[] args) {
        try {
            // 1.
            Directory rootDir = new Directory("root");
            //2.
            Directory binDir = new Directory("bin");
            Directory usrDir = new Directory("usr");
            File tmp = new File("tmp", 222);
            rootDir.add(binDir);
            rootDir.add(usrDir);
            rootDir.add(tmp);
            // 3.
            File vi = new File("vi", 333);
            File latex = new File("latex", 444);
            binDir.add(vi);
            binDir.add(latex);
            Directory yukiDir = new Directory("yuki");
            Directory hanakoDir = new Directory("hanako");
            Directory tomuraDir = new Directory("tomura");
            usrDir.add(yukiDir);
            usrDir.add(hanakoDir);
            usrDir.add(tomuraDir);
            //4.
            File diary = new File("diary.html", 100);
            File composite = new File("Composite.java", 500);
            yukiDir.add(diary);
            yukiDir.add(composite);
            File game = new File("game.doc", 600);
            File iunk = new File("iunk.mail", 700);
            tomuraDir.add(game);
            tomuraDir.add(iunk);
            rootDir.printList();
        } catch (RuntimeException e) {
            e.printStackTrace();
        }
    }
}
